<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="styles/style.css">
        <link rel="stylesheet" href="styles/theme/atom-one-dark.css">
        <title>例子35-ES6/7常用语法介绍</title>
    </head>

    <body>
        <pre>
            <code>
                // 例子35

                let obj = {a: 'apple', 100: 100, 2: 2, b: 'banana', c: 'cartoon'};

                for(let key of Object.keys(obj)) {
                    console.log(key); // 前后分别输出"2" "100" "a" "b" "c"
                }

                for(let value of Object.values(obj)) {
                    console.log(value); // 前后分别输出2 100 "apple" "banana" "cartoon"
                }

                for(let [key, value] of Object.entries(obj)) {
                    console.log([key, value]); // 前后分别输出["2", 2] ["100", 100] ["a", "apple"] ["b", "banana"] ["b", "cartoon"]
                }
            </code>
        </pre>
        <script src="scripts/libs/highlight.pack.js"></script>
        <script src="scripts/35.js"></script>
        <script>
            hljs.initHighlightingOnLoad();
        </script>
    </body>

</html>